<!--
 * @Descripttion: 
 * @version: 
 * @Author: cmg
 * @Date: 2020-01-07 11:22:28
 * @LastEditTime: 2020-01-09 11:10:54
 -->
{include file="public/header"}
<link rel="stylesheet" href="__ADMIN__layui/css/view/login/login.css" media="all">
<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">

  <div class="layadmin-user-login-main">
    <div class="layadmin-user-login-box layadmin-user-login-header">
      <h2>layuiAdmin</h2>
      <p>layui 官方出品的单页面后台管理模板系统</p>
    </div>
    <form  class="layui-form" id="login">
    <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
      <div class="layui-form-item">
        <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
        <input type="text" name="admin_name"   placeholder="用户名" class="layui-input">
      </div>
      <div class="layui-form-item">
        <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
        <input type="password" name="admin_pwd"  placeholder="密码" class="layui-input">
      </div>
      <div class="layui-form-item">
        <div class="layui-row">
          <div class="layui-col-xs7">
            <label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="LAY-user-login-vercode"></label>
            <input type="text" name="vercode" maxlength="4"  placeholder="图形验证码" class="layui-input">
          </div>
          <div class="layui-col-xs5">
            <div style="margin-left: 10px;">
              <img src="{:captcha_src()}"  onclick="this.src='{:captcha_src()}?seed='+Math.random()" class="layadmin-user-login-codeimg" id="vercode">
            </div>
          </div>
        </div>
      </div>
      <div class="layui-form-item" style="margin-bottom: 20px;">
        <input type="checkbox" name="remember" checked value="true"  lay-skin="primary" title="记住密码">
        <a lay-href="/user/forget" class="layadmin-user-jump-change layadmin-link" style="margin-top: 7px;">忘记密码？</a>
      </div>
      <div class="layui-form-item">
        <button type="button" class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit">登 入</button>
      </div>
    </div>
    </form>
  </div>
</div>
{include file="public/footer"}
<script>
layui.use(['form'], function(){
  var $ = layui.$
  ,form = layui.form
  ,router = layui.router()
  ,search = router.search;

  form.render();

  //提交
  form.on('submit(LAY-user-login-submit)', function(obj){
    var login_data={};
    login_data.admin_name=$("input[name='admin_name']").val();
    login_data.admin_pwd=$("input[name='admin_pwd']").val();
    login_data.vercode=$("input[name='vercode']").val();
    login_data.remember=$("input[name='remember']").val();
    //请求登入接口
    bt.ajax({
      url:"{:url('')}",
      type:"post",
      data:login_data,
      success:function (res) {
          if(res.code==200){
            bt.msg_txt(res.msg,2000,res.data.url);
          }else{
              bt.msg_txt(res.msg);
              $("#vercode").click();

          }
      }



    })
    
  });

  
});
</script>